﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMatrix.WebData;

namespace Consultas.Controllers
{
    public class AccountController : Controller
    {
        //LOGIN
        [HttpGet]
        public ActionResult Login()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Login(string username, string password)
        {

            if (WebSecurity.Login(username, password, false))
            {
                ViewBag.LogError = false;
                return RedirectToAction("index", "Consulta");
            }
            
            ViewBag.LogError = true;
            return View("login");
        }

        //LOGOUT
        public ActionResult Logout()
        {
            WebSecurity.Logout();
            return RedirectToAction("index", "Consulta");
        }

        
    }
}
